% TEST_ID: LANG-EXPAND-0024
% CATEGORY: language/array-ops/cat
% 测试水平拼接数组

function test_horzcat
    A = [1, 2; 3, 4];
    B = [5, 6; 7, 8];
    C = horzcat(A, B);
    assert(isequal(C, [1, 2, 5, 6; 3, 4, 7, 8]));

    A = [1; 2];
    B = [3, 4; 5, 6];
    C = horzcat(A, B);
    assert(isequal(C, [1, 3, 4; 2, 5, 6]));

    A = [1, 2, 3];
    B = [4, 5, 6];
    C = horzcat(A, B);
    assert(isequal(C, [1, 2, 3, 4, 5, 6]));

    A = 'Hello';
    B = 'World';
    C = horzcat(A, B);
    assert(isequal(C, 'HelloWorld'));

    A = {1, 2;3, 4};
    B = {5, 6;7, 8};
    C = horzcat(A, B);
    assert(isequal(C, {1, 2, 5, 6;3, 4, 7, 8}));

    A = [{1}, 2];
    B = {3, 4};
    C = horzcat(A, B);
    assert(isequal(C, {1, 2, 3, 4}));

    A = rand(2, 2, 2);
    B = rand(2, 2, 2);
    C = horzcat(A, B);
    assert(isequal(size(C), [2, 4, 2]));
end


